Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model.setMetaDefaults should be model.setDefaults #40

Closed
wants to merge 1 commit into from

Conversation

jeffbski
Copy link

model.setMetaDefaults does not exist and causes a render error

model.setMetaDefaults does not exist and causes a render error
@jeffbski
Copy link
Author

Actually in looking at the code, I see that file.coffee does have a setMetaDefaults method, so I am not sure why that doesn't work, but it is easy to see the error if one does:

docpad generate --env static

outputs the error

error: An error occured:
TypeError: Object #<Model> has no method 'setDefaults'
    at DocumentModel.FileModel.setMetaDefaults (/usr/local/lib/node_modules/docpad/out/lib/models/file.js:271:20)
    at FilesCollection.<anonymous> (/Users/jeff/projects/mysite-docpad-bootstrap/docpad.coffee:44:24)
    at triggerEvents (/usr/local/lib/node_modules/docpad/node_modules/backbone/backbone.js:206:57)
    at FilesCollection.Backbone.Events.trigger (/usr/local/lib/node_modules/docpad/node_modules/backbone/backbone.js:

Just doing docpad run seems to hang without showing the error, so that's how I discovered it with the static

@jeffbski
Copy link
Author

So actually maybe setMetaDefaults itself is broken??

@jeffbski
Copy link
Author

I had updated my previous comment with the error:

error: An error occured:
TypeError: Object #<Model> has no method 'setDefaults'
    at DocumentModel.FileModel.setMetaDefaults (/usr/local/lib/node_modules/docpad/out/lib/models/file.js:271:20)
    at FilesCollection.<anonymous> (/Users/jeff/projects/mysite-docpad-bootstrap/docpad.coffee:44:24)
    at triggerEvents (/usr/local/lib/node_modules/docpad/node_modules/backbone/backbone.js:206:57)
    at FilesCollection.Backbone.Events.trigger (/usr/local/lib/node_modules/docpad/node_modules/backbone/backbone.js:

So that might help in finding the issue

@balupton
Copy link
Member

Definitely was a bug in DocPad, will be fixed in the next release.

balupton added a commit to docpad/docpad that referenced this pull request Jul 26, 2013
…werver

- Fixed virtual documents firing duplicated events
	- Added `cloneModel(model)` to properly handle events when cloning
(`model.clone()` will no longer clone events)
- Fixed `Object #<Model> has no method 'setDefaults'` error (bug since
v6.46.3)
	- Moved `FileModel::setDefaults` back into `Base::setDefaults`
	- Thanks to [Jeff Barczewski](https://github.com/jeffbski) for
[docpad-archive/documentation#40](https://github.com/bevry/docpad-document
ation/pull/40)
- Fixed the 500 middleware not working
- Added ability to do `getCollection('database')` to get the global
database
- Added `render` alias for documents directory
- Added `static` alias for files directory
- The `documents` collection is now defiend by `render:true,
write:true` rather than being paths and `isDocument:true` based
- The `files` collection is now defiend by `render:false, write:true`
rather than being paths and `isFile:true` based
- The `html` collection is now checks for `write:true` instead of
`isDocument:true` or `isFile:true`
- The `stylesheet` collection is now checks for `write:true` instead of
`isDocument:true` or `isFile:true`
- Re-added `DocPad::parseDocumentDirectory` and `parseFileDirectory`
(removed from v6.46.0) which wraps around the new ways of doing things
- Added `DocPad::createModel(attrs,opts)` and updated
`DocPad::createDocument` and `DocPad::createFile` to use it
- Added `DocPad::ensureModel(attrs,opts)` and updated
`DocPad::ensureDocument`, `DocPad::ensurefile`, and
`DocPad::ensureFileOrDocument` to use it
- Added `DocPad::attachModelEvents(model)` to attach the required
docpad events to a model
@jeffbski
Copy link
Author

Great! Well once it is released we can close this pull request since it won't be needed. Thanks for the quick work of finding that. I have just learned about this project and thus far am really enjoying using it!

@balupton
Copy link
Member

Should be fixed in the just released v6.46.4 - closing, happy to re-open if it is still an issue :) - thanks 👍

@balupton balupton closed this Jul 27, 2013
balupton added a commit to docpad/docpad that referenced this pull request Jul 27, 2013
- v6.46.4 July 27, 2013
	- Fixes
		- Fixed virtual documents firing duplicated events
			- Plugins should now use `DocPad::cloneModel(model)` instead of
`model.clone()` as the latter can't bind events correctly
		- Fixed `Object #<Model> has no method 'setDefaults'` error (bug
since v6.46.3)
			- Moved `FileModel::setDefaults` back into `Base::setDefaults`
			- Thanks to [Jeff Barczewski](https://github.com/jeffbski) for
[docpad-archive/documentation#40](https://github.com/bevry/docpad-document
ation/pull/40)
		- Fixed the 500 middleware not working
	- Changes
		- The `documents` collection is now defined by `render:true,
write:true` rather than being paths and `isDocument:true` based
		- The `files` collection is now defined by `render:false, write:true`
rather than being paths and `isFile:true` based
		- The `html` collection now checks for `write:true` instead of
`isDocument:true` or `isFile:true`
		- The `stylesheet` collection now checks for `write:true` instead of
`isDocument:true` or `isFile:true`
	- Additions
		- Added ability to do `getCollection('database')` to get the global
database
		- Added naming to collections to easily identify which collection we
are in when debugging
		- Added `render` alias for documents directory
		- Added `static` alias for files directory
		- Added logging for event emits
		- Re-added `DocPad::parseDocumentDirectory` and `parseFileDirectory`
(removed from v6.46.0) which wraps around the new ways of doing things
		- Added `DocPad::createModel(attrs,opts)` and updated
`DocPad::createDocument` and `DocPad::createFile` to use it
		- Added `DocPad::ensureModel(attrs,opts)` and updated
`DocPad::ensureDocument`, `DocPad::ensurefile`, and
`DocPad::ensureFileOrDocument` to use it
		- Added `DocPad::attachModelEvents(model)` to attach the required
docpad events to a model
@jeffbski
Copy link
Author

Thanks! yes that codefix worked and now the setMetaDefault works like it was documented.

Zearin pushed a commit to Zearin/docpad that referenced this pull request May 7, 2014
…werver

- Fixed virtual documents firing duplicated events
	- Added `cloneModel(model)` to properly handle events when cloning
(`model.clone()` will no longer clone events)
- Fixed `Object #<Model> has no method 'setDefaults'` error (bug since
v6.46.3)
	- Moved `FileModel::setDefaults` back into `Base::setDefaults`
	- Thanks to [Jeff Barczewski](https://github.com/jeffbski) for
[docpad-archive/documentation#40](https://github.com/bevry/docpad-document
ation/pull/40)
- Fixed the 500 middleware not working
- Added ability to do `getCollection('database')` to get the global
database
- Added `render` alias for documents directory
- Added `static` alias for files directory
- The `documents` collection is now defiend by `render:true,
write:true` rather than being paths and `isDocument:true` based
- The `files` collection is now defiend by `render:false, write:true`
rather than being paths and `isFile:true` based
- The `html` collection is now checks for `write:true` instead of
`isDocument:true` or `isFile:true`
- The `stylesheet` collection is now checks for `write:true` instead of
`isDocument:true` or `isFile:true`
- Re-added `DocPad::parseDocumentDirectory` and `parseFileDirectory`
(removed from v6.46.0) which wraps around the new ways of doing things
- Added `DocPad::createModel(attrs,opts)` and updated
`DocPad::createDocument` and `DocPad::createFile` to use it
- Added `DocPad::ensureModel(attrs,opts)` and updated
`DocPad::ensureDocument`, `DocPad::ensurefile`, and
`DocPad::ensureFileOrDocument` to use it
- Added `DocPad::attachModelEvents(model)` to attach the required
docpad events to a model
Zearin pushed a commit to Zearin/docpad that referenced this pull request May 7, 2014
- v6.46.4 July 27, 2013
	- Fixes
		- Fixed virtual documents firing duplicated events
			- Plugins should now use `DocPad::cloneModel(model)` instead of
`model.clone()` as the latter can't bind events correctly
		- Fixed `Object #<Model> has no method 'setDefaults'` error (bug
since v6.46.3)
			- Moved `FileModel::setDefaults` back into `Base::setDefaults`
			- Thanks to [Jeff Barczewski](https://github.com/jeffbski) for
[docpad-archive/documentation#40](https://github.com/bevry/docpad-document
ation/pull/40)
		- Fixed the 500 middleware not working
	- Changes
		- The `documents` collection is now defined by `render:true,
write:true` rather than being paths and `isDocument:true` based
		- The `files` collection is now defined by `render:false, write:true`
rather than being paths and `isFile:true` based
		- The `html` collection now checks for `write:true` instead of
`isDocument:true` or `isFile:true`
		- The `stylesheet` collection now checks for `write:true` instead of
`isDocument:true` or `isFile:true`
	- Additions
		- Added ability to do `getCollection('database')` to get the global
database
		- Added naming to collections to easily identify which collection we
are in when debugging
		- Added `render` alias for documents directory
		- Added `static` alias for files directory
		- Added logging for event emits
		- Re-added `DocPad::parseDocumentDirectory` and `parseFileDirectory`
(removed from v6.46.0) which wraps around the new ways of doing things
		- Added `DocPad::createModel(attrs,opts)` and updated
`DocPad::createDocument` and `DocPad::createFile` to use it
		- Added `DocPad::ensureModel(attrs,opts)` and updated
`DocPad::ensureDocument`, `DocPad::ensurefile`, and
`DocPad::ensureFileOrDocument` to use it
		- Added `DocPad::attachModelEvents(model)` to attach the required
docpad events to a model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants